class ATM():
    money = 50000
    area = "农大"

    def draw_money(self, get_money, user):
        if get_money <= self.money and user.money >= get_money:
            self.money -= get_money
            user.money -= get_money
    def add_money(self, money):
        self.money += money

class User():
    def __init__(self, username, passwd, money):
        self.username = username
        self.passwd = passwd
        self.money = money

def meau():
    print("#" * 50)
    print("  1、查询余额".center(50))
    print("2、取款".center(50))
    print("3、存款".center(50))
    print("4、退出".center(50))
    print("#" * 50)

atm = ATM()
user = User("cali", "123456", 8000)

print("*****输入用户名密码登录*****")
while 1:
    username = input("输入用户名：")
    pwd = input("输入密码：")
    if username==user.username and pwd == user.passwd:
        print("登录成功！")

        while 1:
            meau()
            option = input("请选择要进行的操作：")
            if option == "1":
                print(f"余额为:{user.money}")
            elif option == "2":
                mount = int(input("取多少："))
                if mount > atm.money:
                    print("取款机余额不足")
                elif mount > user.money:
                    print("你的余额不足")
                else:
                    atm.draw_money(mount,user)
                    # user.draw_money(mount)
                    print(f"取款成功，余额为{user.money}")
            elif option == "3":
                mount = int(input("存多少："))
                atm.add_money(mount)
                #user.add_money(mount)
                print(f"存款成功，余额为{user.money}")

            elif option == "4":
                print("退出成功")
                break
        break
    else:
        print("输入有误，请重新输入")